import request from '@/utils/request'

export function createTask(data) {
  return request({
    url: 'api/dev/data/export/task',
    method: 'post',
    data
  })
}

export function delFileDataFile(id) {
  return request({
    url: 'api/dev/data/export/task/del/data/file/' + id,
    method: 'delete'
  })
}

export function batchDelFileDataFile(ids) {
  return request({
    url: 'api/dev/data/export/task/del/data/file/batchDel',
    method: 'delete',
    data: ids
  })
}

export function continueRunById(id) {
  return request({
    url: 'api/dev/data/export/task/continue/run/' + id,
    method: 'put'
  })
}

export function suspend(ids) {
  return request({
    url: 'api/dev/data/export/task/suspend',
    method: 'put',
    data: ids
  })
}

export function abolish(ids) {
  return request({
    url: 'api/dev/data/export/task/abolish',
    method: 'put',
    data: ids
  })
}

export function restart(ids) {
  return request({
    url: 'api/dev/data/export/task/restart',
    method: 'put',
    data: ids
  })
}

export function reset(ids) {
  return request({
    url: 'api/dev/data/export/task/reset',
    method: 'put',
    data: ids
  })
}

export function countFtpTakeUp() {
  return request({
    url: 'api/dev/data/export/task/countFtpTakeUp',
    method: 'get'
  })
}

export function findListByPage(params) {
  return request({
    url: 'api/dev/data/export/task/page',
    method: 'get',
    params
  })
}

export function upload(data) {
  return request({
    url: 'api/dev/data/export/task/upload',
    data: data,
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data;boundary=' + new Date().getTime()
    }
  })
}

export function del(ids) {
  return request({
    url: 'api/dev/data/export/task/batchRemove' + '/' + ids,
    method: 'delete',
    ids
  })
}

export default {
  createTask,
  delFileDataFile,
  batchDelFileDataFile,
  upload,
  continueRunById,
  suspend,
  abolish,
  restart,
  reset,
  countFtpTakeUp,
  findListByPage,
  del
}
